package com.power.doc.model.base;

import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
import java.util.Objects;

public class BaseDoc implements Serializable, Comparable<BaseDoc> {

    protected static final long serialVersionUID = 7211922919532562867L;

    /**
     * method name
     *
     * @since 1.7.3 +
     */
    protected String name;

    /**
     * 中文显示名
     */
    protected String showName;

    /**
     * method order
     *
     * @since 1.7+
     */
    protected int order;


    /**
     * method description
     */
    protected String desc;

    /**
     * detailed introduction of the method
     */
    protected String detail;

    protected String version;

    protected String since;

    protected String see;

    protected String link;
    /**
     * method deprecated
     */
    protected boolean deprecated;

    protected String deprecatedDesc;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getShowName() {
        return showName;
    }

    public void setShowName(String showName) {
        this.showName = showName;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getSince() {
        return since;
    }

    public void setSince(String since) {
        this.since = since;
    }

    public String getSee() {
        return see;
    }

    public void setSee(String see) {
        this.see = see;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public boolean isDeprecated() {
        return deprecated;
    }

    public void setDeprecated(boolean deprecated) {
        this.deprecated = deprecated;
    }

    public String getDeprecatedDesc() {
        return deprecatedDesc;
    }

    public void setDeprecatedDesc(String deprecatedDesc) {
        this.deprecatedDesc = deprecatedDesc;
    }

    @Override
    public int compareTo(@NotNull BaseDoc o) {
        if (Objects.nonNull(o.getDesc())) {
            return desc.compareTo(o.getDesc());
        }
        return name.compareTo(o.getName());
    }
}
